//
//  AddfriendsViewController.m
//  模拟-百思不得姐
//
//  Created by 谭浔明 on 16/8/9.
//  Copyright © 2016年 chunyu. All rights reserved.
//

#import "AddfriendsViewController.h"

@interface AddfriendsViewController ()

@property (weak, nonatomic) IBOutlet UITextField *tf;

@end

@implementation AddfriendsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"添加好友";
    // Do any additional setup after loading the view from its nib.
}

- (IBAction)addBtn:(id)sender {
    
    EMError *error = [[EMClient sharedClient].contactManager addContact:self.tf.text message:@"我想加您为好友"];
    if (!error) {
        UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"添加好友请求发送成功" preferredStyle:(UIAlertControllerStyleAlert)];
        UIAlertAction *sure = [UIAlertAction actionWithTitle:@"确定" style:(UIAlertActionStyleCancel) handler:nil];
        [alert addAction:sure];
        [self presentViewController:alert animated:YES completion:nil];
    } else {
        XMGLog(@"%@", error.errorDescription);
    }
 
}


@end
